package com.mq.pro;
import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.common.message.Message;

public class Procer {
    public static void main(String[] args) throws Exception {
        DefaultMQProducer producer = new DefaultMQProducer(
                "producer_group",
                true,
                "Topic_test_01");
        producer.setNamesrvAddr("127.0.0.1:9876");
        producer.start();

        for (int i = 0; i < 3; i++) {
            Message msg = new Message(
                    "Topic_test_01",
                    "tagStr",
                    ("( " + i + " )message from mq2.3_rmqdemo producer").getBytes());
            msg.setKeys("TK_Topic_test_01");
            producer.send(msg);
        }
        System.out.println("Send Finished.");
    }
}
